@extends('layouts.master3')
@section("title")
    {{$dis->title}}
@endsection
@section("edstyle")
    <link rel="stylesheet" href="/css/edit/style.css">
    <link rel="stylesheet" href="/css/edit/editormd.css">
    <link rel="stylesheet" href="/css/highlight/styles/idea.css">
@endsection
@section("css")
    <link href="/css/discuss.css" rel="stylesheet">
    <link href="/css/login.css" rel="stylesheet">
@endsection
@section("content")
    <?php
    use App\Utils;
    use App\Permission;
    ?>
    <div class="contain">

        <div class="qa-body-wrapper">
            <div class="qa-main-shadow">
                <div class="qa-main-wrapper">

                    <!-- nav-main E-->
                    <div class="qa-sidepanel">
                        <div class="" style="margin-bottom:20px;">
                            @if(count($tasks)>0)
                                <a target="_blank" href="/task/{{Utils::id2url($tasks[0]->id)}}"
                                   class="btn btn-primary back-q">查看task</a>
                            @endif
                        </div>
                        <div class="qa-sidebar well">
                            @if($dis->tag === 'topic')
                                @include('dis.topic_bulletin')
                            @else
                                @include('dis.bulletin')
                            @endif
                        </div>
                        @if($dis->tag === 'topic')
                            <div class="qa-sidebar well">
                                @include('dis.topic_award')
                            </div>
                        @endif

                    </div>
                    <!-- qa-sidebar E-->
                    <div class="qa-main qa-template-question">
                        <div class="qa-part-q-view">
                            <div class="qa-q-view  hentry question" id="q15521">
                                <div class="qa-q-view-stats">
                                    <div class="qa-voting qa-voting-net" id="">
                                        <a class="qa-user-link fl black qlUser" tabindex="0"
                                           href="{{Utils::tree($dis->author->id)}}" role="button" data-html="true"
                                           data-toggle="popover" data-placement="right"
                                           data-trigger="hover"
                                           data-content="<div class='namecard-main'><img src='{{$dis->author->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$dis->author->name}}</div><div class='namecard-job'>{{$dis->author->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$dis->author->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($dis->author->score / 100) }}</span></div></div></div>">
                                            <img src="{{$dis->author->avatar->url('thumb')}}" alt="用户头像avatar">
                                        </a>
                                    </div>
                                </div>
                                <div class="qa-q-view-main">
                                <span class="qa-view-count">
                                </span>
                                    <div class="qa-q-view-content">
                                        <a class="qa-q-title">{{$dis->title}}</a>
                                        @if($dis->tag === 'topic' && $dis->end_time != null)
                                            <span class="countdown"><?php
                                                $now = new DateTime();
                                                $end = new DateTime($dis->end_time);
                                                $diff = $end->diff($now);
                                                $days = $diff->format('%a');
                                                $hours = $diff->format('%h');
                                                $minutes = $diff->format('%i');
                                                if ($now < $end) {
                                                    $ret = "";
                                                    if ($days > 0) {
                                                        $ret .= $days . "天";
                                                    }
                                                    if ($hours > 0) {
                                                        $ret .= $hours . "小时";
                                                    }
                                                    if ($hours == 0) {
                                                        $ret .= $minutes . "分钟";
                                                    }
                                                    echo "还有" . $ret . "结束";
                                                } else {
                                                    echo "已经结束";
                                                }
                                                ?></span>
                                        @endif
                                        <div class="entry-content markdown-body" style="margin-top: 15px;">
                                            <?php echo $dis->content;?>
                                        </div>
                                    </div>

                                    <span class="qa-q-view-avatar-meta">
                                    <span class="qa-q-view-meta">
                                        {{--<a target="_blank" href="{{Utils::tree($dis->userid)}}"--}}
                                        {{--class="qa-user-link gray"> {{$dis->user->name}}</a>--}}
                                        <a class="qa-user-link fl black qlUser" tabindex="0"
                                           href="{{Utils::tree($dis->author->userid)}}" role="button" data-html="true"
                                           data-toggle="popover" data-placement="right"
                                           data-trigger="hover"
                                           data-content="<div class='namecard-main'><img src='{{$dis->author->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$dis->author->name}}</div><div class='namecard-job'>{{$dis->author->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$dis->author->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($dis->author->score / 100) }}</span></div></div></div>">
                                            {{$dis->author->name}}
                                        </a>
                                        &nbsp;
										<span class="qa-q-view-when"> {{$dis->created_at}}
                                            提问 @if (Auth::check()&&($dis->user->id==Auth::user()->id || Permission::user_is_super(Auth::user()) ))
                                                <a class="gray" href="/q/{{Utils::id2url($dis->id)}}/edit">编辑</a>
                                            @endif</span>


                                        @if (Auth::check()&&($dis->user->id==Auth::user()->id || Permission::user_is_super(Auth::user()) ))
                                            <a class="gray" href="/q/{{Utils::id2url($dis->id)}}/del">删除</a>
                                        @endif
                                        @if($dis->tag!="其他")
                                            <a class="qa-q-item-class gray" href="/discuss/{{$dis->tag}}"
                                               target="_blank"> {{$dis->tag}}</a>
                                        @endif
                                    </span>
                                </span>
                                </div> <!-- END qa-q-view-main -->
                                <div class="qa-q-view-clear">
                                </div>
                            </div>

                        </div><!-- END qa-q-view -->
                        <div class="qa-part-a-list">
                            <div id="a_list_title">{{$comments->count()}} 个回答</div>
                            <div class="qa-a-list" id="a_list">
                                @foreach($comments as $com)
                                    <div class="qa-a-list-item  hentry answer" id="{{Utils::id2url($com->id)}}">
                                        <div class="pull-left">
                                            <div class="vote">
                                                <button class="up @if($com->fav==1) press @endif"
                                                        data-token="{{csrf_token()}}" data-id="{{$com->id}}"
                                                        data-type="1" title="赞同"
                                                        @if (!Auth::check() || $com->userid == Auth::user()->id)
                                                        disabled
                                                        @endif
                                                >
                                                    @if (Auth::check() && $com->userid != Auth::user()->id)
                                                        <i class="vote_arrow"></i>
                                                    @endif
                                                    <span class="count"
                                                          data-count="{{$com->score}}">{{$com->score}}</span>
                                                </button>
                                                @if (Auth::check() && $com->userid != Auth::user()->id)
                                                <button class="down @if($com->fav==2) press @endif "
                                                        commented="{{ $com->commented }}"
                                                        data-statu="false"
                                                        data-token="{{csrf_token()}}"
                                                        data-id="{{$com->id}}"
                                                        data-type="1"
                                                        data-toggle="modal"
                                                        data-target="#downvote-reason-{{ $com->id }}"
                                                        title="反对">
                                                    <i class="vote_arrow"></i>
                                                </button>

                                                @endif

                                            @if($com->jinghua!=0)
                                                    <div class="accepted-flag">
                                                        @if($com->jinghua==1)
                                                            老司机
                                                        @elseif($com->jinghua==2)
                                                            优胜
                                                        @endif
                                                    </div>
                                                @endif
                                            </div>
                                        </div>
                                        @if (Auth::check() && $com->userid != Auth::user()->id)
                                        <div class="modal fade downvote-reason-modal" id="downvote-reason-{{ $com->id }}" tabindex="-1" role="dialog"
                                             aria-labelledby="myModalLabel">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close"
                                                                data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                        <h4 class="modal-title" id="myModalLabel">反对的理由……</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        请详细说明反对的理由,反对的理由会作为该回复的评论:
                                                        <div style="width: 80%;margin: 15px auto 0px auto;">
                                                            <textarea style="width: 100%" rows="5"></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <p class="downvote-warning-modal" style="text-align: left;float: left;color: red;"></p>
                                                        <button type="button" class="btn btn-default"
                                                                data-dismiss="modal">关闭
                                                        </button>
                                                        <button type="button" class="btn btn-primary modal-downvote-btn">提交评论</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        @endif
                                        <div class="qa-a-item-main">

                                            <div class="qa-a-item-content">
                                                @if ($ended)
                                                    <a class="qa-user-link fl black qlUser" tabindex="0"
                                                       href="{{Utils::tree($com->userid)}}" role="button"
                                                       data-html="true"
                                                       data-toggle="popover" data-placement="right"
                                                       data-trigger="hover"
                                                       data-content="<div class='namecard-main'><img src='{{$com->user->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$com->user->name}}</div><div class='namecard-job'>{{$com->user->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$com->user->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($com->user->score / 100) }}</span></div></div></div>">
                                                        {{$com->user->name}}
                                                    </a>
                                                    <span class="fl overhidden qa-a-intr">， {{$com->user->introduce}}</span>
                                                @else
                                                    <a class="qa-user-link fl black">{{$com->user->name}}</a>
                                                @endif
                                                @if ($ended)
                                                    <a class="qa-a-avatar fr qlUser" tabindex="0"
                                                       href="{{Utils::tree($com->userid)}}" role="button"
                                                       data-html="true"
                                                       data-toggle="popover" data-placement="left"
                                                       data-trigger="hover"
                                                       data-content="<div class='namecard-main'><img src='{{$com->user->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$com->user->name}}</div><div class='namecard-job'>{{$com->user->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$com->user->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($com->user->score / 100) }}</span></div></div></div>">
                                                        <img src="{{$com->user->avatar->url('thumb')}}" width="30" height="30" class="fr">
                                                    </a>
                                                @else
                                                    <img src="http://www.qlcoder.com/avatars/thumb/missing.png" width="30"
                                                         height="30" class="fr">
                                                @endif

                                                <div class="clear"></div>
                                                <div class="vote-count gray">
                                                    <span class='vote-count' id="upvote-count-{{$com->id}}">{{$com->vote}}</span>
                                                    人赞同,
                                                    <span class='vote-count' id="downvote-count-{{$com->id}}">{{$com->down_vote}}</span>
                                                    人反对
                                                </div>
                                                <div class="entry-content markdown-body">
                                                    <p><?php echo $com->comment;?></p></div>
                                            </div>
                                            <span class="qa-a-item-avatar-meta" id="r{{Utils::id2url($com->id)}}">

                                        <span class="qa-a-item-meta">
											<span class="qa-a-item-when">{{$com->created_at}}</span>
                                            <a href="javascript:;" class="gray _pl"><i style="padding-left: 5px; font-size: 12px;" class="iconfont icon-huifu-copy"></i>  {{count($com->respons)}}条评论</a>
												
                                                @if (Auth::check()&&(Auth::user()->id==$com->userid) || Auth::check() && Permission::user_is_super(Auth::user()))
                                                    <a target="_blank" class="gray"
                                                       href="/editdis/{{Utils::id2url($com->id)}}"> 编辑 </a>
                                                @endif
                                                @if (Auth::check()&&Auth::user()->id == $com->userid)
                                                    <a target="_blank" class="gray"
                                                       href="/deldis/{{Utils::id2url($com->id)}}"> 删除 </a>
                                                @endif
                                                @if (Auth::check() && Permission::user_is_super(Auth::user()))
                                                    <button class="btn-link gray" data-toggle="modal"
                                                            data-target="#myModal{{ $com->id }}">
                                                        删除
                                                    </button>

                                                    <!-- 模态框（Modal） -->
                                                    <div class="modal fade" id="myModal{{ $com->id }}" tabindex="-1"
                                                         role="dialog"
                                                         aria-labelledby="myModalLabel" aria-hidden="true">
                                                <div class="modal-dialog">
                                                <div class="modal-content">
                                                <div class="modal-header">
                                                <button type="button" class="close"
                                                        data-dismiss="modal" aria-hidden="true">
                                                &times;
                                                </button>
                                                <h4 class="modal-title" id="myModalLabel">
                                                原因
                                                </h4>
                                                </div>
                                                <form id="reason_form"
                                                      action="/deldis/{{Utils::id2url($com->id)}}"
                                                      method="GET">
                                                <div class="modal-body">

                                                <input class="ql_comment_editable editable"
                                                       placeholder="删除的原因（默认为'回答对千里码社区没有帮助或者违反了社区规则')" type="text"
                                                       name="reason">

                                                </div>
                                                <div class="modal-footer">
                                                <button type="button" class="btn btn-default"
                                                        data-dismiss="modal">关闭
                                                </button>
                                                <button type="submit" class="btn btn-primary">
                                                提交更改
                                                </button>
                                                </div>
                                                </form>
                                                </div><!-- /.modal-content -->
                                                </div><!-- /.modal -->
                                                </div>
                                                @endif
                                                @if (Auth::check() && Permission::user_can_review(Auth::user()))
                                                    @if (isset($type) && $type === 'review')

                                                        <a class="gray"
                                                           href="/vote/delete/approve/{{Utils::id2url($com->id)}}/{{ $review_type }}"> 投票删除 </a>
                                                    @else
                                                        <a class="gray"
                                                           href="/vote/delete/approve/{{Utils::id2url($com->id)}}/100"> 投票删除 </a>
                                                    @endif
                                                @endif

                                                @if (Auth::check() && Permission::user_can_review(Auth::user()))
                                                    @if (isset($type) && $type === 'review')

                                                        <a class="gray"
                                                           href="/vote/pick/approve/{{Utils::id2url($com->id)}}/{{ $review_type }}"> 投票精华 </a>
                                                    @else
                                                        <a class="gray"
                                                           href="/vote/pick/approve/{{Utils::id2url($com->id)}}/100"> 投票精华 </a>
                                                    @endif
                                                @endif

                                                @if(Auth::check() && Permission::user_is_super(Auth::user()))
                                                    <a target="_blank" class="gray"
                                                       href="/updis/{{Utils::id2url($com->id)}}"> 精华 </a>
                                                @endif
                                          <!--  <a href="javascript:;" class="gray _pl"> {{count($com->respons)}}条评论</a>-->
                                        </span>

                                    </span>
                                            <div class="dc none">
                                                <div class="qa-comment-list">
                                                    @foreach($com->respons as $r)
                                                        <div class="media" id="{{Utils::id2url($r->id)}}">
                                                            @if($ended || $r->user->id != $com->user->id)
                                                            <a class="qa-user-link black pull-left qlUser" tabindex="0"
                                                               href="{{Utils::tree($r->user->id)}}" role="button"
                                                               data-html="true"
                                                               data-toggle="popover" data-placement="right"
                                                               data-trigger="hover"
                                                               data-content="<div class='namecard-main'><img src='{{$r->user->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$r->user->name}}</div><div class='namecard-job'>{{$r->user->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$r->user->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($r->user->score / 100) }}</span></div></div></div>">
                                                                <img class="img-circle" alt="Cinque Terre" width="20"
                                                                     height="20"
                                                                     src="{{$r->user->avatar->url("thumb")}}">
                                                            </a>
                                                            @else
                                                                <a class="pull-left">
                                                                    <img class="img-circle" alt="Cinque Terre" width="20" height="20" src="http://www.qlcoder.com/avatars/thumb/missing.png">
                                                                </a>
                                                            @endif
                                                            <div class="media-body">
                                                                <input type="hidden" class="replyName"
                                                                       value="{{$r->user->name}}">
                                                                <h4 class="media-heading">
                                                                    @if($ended || $r->user->id != $com->user->id)
                                                                    <a class="qa-user-link black qlUser" tabindex="0"
                                                                       href="{{Utils::tree($r->user->id)}}"
                                                                       role="button" data-html="true"
                                                                       data-toggle="popover" data-placement="right"
                                                                       data-trigger="hover"
                                                                       data-content="<div class='namecard-main'><img src='{{$r->user->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$r->user->name}}</div><div class='namecard-job'>{{$r->user->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$r->user->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($r->user->score / 100) }}</span></div></div></div>">
                                                                        {{$r->user->name}}
                                                                    </a>
                                                                    @else
                                                                        <a class="gray">{{$r->user->name}}</a>
                                                                    @endif
                                                                    @if($r->ruserid!=0)
                                                                        回复了
                                                                        @if ($ended || $r->ruser->id != $com->user->id)
                                                                        <a class="qa-user-link black qlUser"
                                                                           tabindex="0"
                                                                           href="{{Utils::tree($r->ruser->id)}}"
                                                                           role="button" data-html="true"
                                                                           data-toggle="popover" data-placement="right"
                                                                           data-trigger="hover"
                                                                           data-content="<div class='namecard-main'><img src='{{$r->ruser->avatar->url('thumb')}}' alt=''><div class='namecard-name'>{{$r->ruser->name}}</div><div class='namecard-job'>{{$r->ruser->company}}</div><div class='namecard-numbers clearfix'><div class='szan'><span>排名</span><span class='num'>{{$r->ruser->rank}}</span></div><div class='slike'><span>积分</span><span class='num'>{{ intval($r->ruser->score / 100) }}</span></div></div></div>">
                                                                            {{$r->ruser->name}}
                                                                        </a>
                                                                        @else
                                                                            <a class="gray">{{$r->ruser->name}}</a>
                                                                            @endif
                                                                    @endif
                                                                        @if (Auth::check() && Auth::user()->id == $r->userid)
                                                                            <a target="_blank" class="gray deleteReply fr" data-id="{{Utils::id2url($r->id)}}"
                                                                               href="javascript:;"> 删除 </a>
                                                                        @endif
                                                                </h4>
                                                                {{$r->comment}}
                                                                <div class="ql_comment_ft">
                                                                    <span class="date">{{$r->created_at}}</span>
                                                                    <?php
                                                                    if (Auth::check() && Auth::user()->id !== $r->user->id) {
                                                                        echo '<a href="javascript:;" class="reply ql_comment_op_link gray" name="reply_comment">回复</a>';
                                                                    }
                                                                    ?>

                                                                </div>

                                                                <div class="ql_comment_form expanded"
                                                                     style="display: none;">
                                                                    <div class="ql_comment_editable_wrap">
                                                                        <input class="ql_comment_editable editable"
                                                                               placeholder="写下你的评论" type="text">
                                                                    </div>
                                                                    <div class="ql_command ql_clear">
                                                                        @if(Auth::check())
                                                                            <a href="javascript:;"
                                                                               class="btn btn-primary pull-right replyBtn"
                                                                               data-mid="{{Utils::id2url(Auth::user()->id)}}"
                                                                               data-id="{{Utils::id2url($com->id)}}"
                                                                               data-rid="{{Utils::id2url($r->user->id)}}"
                                                                               data-name="{{Auth::user()->name}}"
                                                                               data-token="{{csrf_token()}}"
                                                                               data-img="{{Auth::user()->avatar->url('thumb')}}"
                                                                               data-rtype="3">回复</a>
                                                                        @endif
                                                                        <a href="javascript:;"
                                                                           class="ql_comment_close ql_command_cancel">取消</a>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div><!-- media END-->
                                                    @endforeach

                                                </div>
                                                @if(!Auth::check())
                                                    <div class="widget-comments">请先 <a class="commentLogin"
                                                                                       href="javascript:void(0);">登录</a>
                                                        后评论
                                                    </div>
                                                @else
                                                    <div class="qa-a-reply">
                                                        <div class="ql_comment_editable editable ql_comment_empty" placeholder="写下你的评论" contenteditable="true" aria-label="写下你的评论.."></div>
                                                        <div class="ql_command ql_clear none">
                                                            <a href="javascript:;"
                                                               class="btn btn-primary pull-right qa-replyBtn"
                                                               data-mid="{{Utils::id2url(Auth::user()->id)}}"
                                                               data-id="{{Utils::id2url($com->id)}}"
                                                               data-token="{{csrf_token()}}"
                                                               data-name="{{Auth::user()->name}}"
                                                               data-img="{{Auth::user()->avatar->url('thumb')}}"
                                                               data-rtype="3">回复</a>
                                                            <a href="javascript:;"
                                                               class="qa-ql_comment_close qa-ql_command_cancel">取消</a>
                                                        </div>
                                                    </div>
                                                @endif
                                            </div>
                                        </div> <!-- END qa-a-item-main -->
                                        @if(isset($type) and $type == 'review')
                                            @if($review_type  == 2)
                                                @include('dis.review_delete_button')
                                            @elseif($review_type  == 3) {
                                            @include('dis.review_jinghua_button')
                                            @else
                                                @include('dis.review_button')
                                            @endif
                                        @endif
                                        <div class="qa-a-item-clear"></div>


                                    </div> <!-- END qa-a-list-item -->
                                @endforeach

                            </div> <!-- END qa-a-list -->

                        </div>
                        <h3 style="text-indent: -999em">啦啦啦</h3>
                        <form method="POST" action="/replydis" accept-charset="UTF-8" id="q-answer-form"><input
                                    name="_token" type="hidden" value="{{csrf_token()}}">
                            <div id="test-editormd" data-authority="@if(!Auth::check())1 @endif">
                                <textarea name="text" style="display:none;" id="textarea"></textarea>
                            </div>
                            <input name="cid" type="hidden" value="{{$dis->id}}" id="cid">
                            <input name="text_html" type="hidden" value="" id="text_html">
                            <a class="btn btn-primary pull-right q-answer" value="回答">回答</a>
                        </form>
                        <!--<div class="qa-suggest-next">-->
                        <!--<a href="">加载更多</a>-->
                        <!--</div>-->
                    </div>
                </div>
            </div>
        </div>
        <!-- 弹窗部分开始 S -->
        <div class="task-shadow none" style="opacity:.3;"></div>
        <img class="loadding_img none" src="/img/loadding.gif" alt="正在加载中"
             style="display: block;position: fixed;top: 50%;left: 50%;margin-top: -10px;margin-left: -50px;">
        <div class="authority none"
             style="width:550px;position:fixed;top:50%;left:50%;margin-top:-265px;margin-left:-275px;z-index: 2222222">
            <div class="authority-warp" style="position:relative">
                <a href="javascript:;" class="authority-close" style="position:absolute;top:6px;right:10px;">X</a>
                <div class="panel panel-login">
                    <!--<h2 style="margin-left: 30px;">千里码</h2>
  
                    <p style="font-size: 18px;margin-left: 30px;">与开发者分享你的技术和实战经验</p>-->
                    <div class="panel-heading">
                        <div class="row">
                            <div class="col-xs-6">
                                <a href="#" class="active" id="login-form-link">登录</a>
                            </div>
                            <div class="col-xs-6">
                                <a href="#" id="register-form-link" class="">注册</a>
                            </div>
                        </div>
                        <hr>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <form id="login-form" action="/auth/login" method="post" role="form"
                                      style="display: block;">
                                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                                    <div class="form-group">
                                        <input type="text" name="email" id="email" tabindex="1" class="form-control"
                                               placeholder="邮箱" value="">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" name="password" id="password" tabindex="2"
                                               class="form-control" placeholder="密码">
                                    </div>
                                    <div class="form-group text-center">
                                        <input type="checkbox" tabindex="3" class="" name="remember" id="remember">
                                        <label for="remember"> 记住我</label>
                                    </div>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-sm-6 col-sm-offset-3">
                                                <input type="submit" name="login-submit" id="login-submit" tabindex="4"
                                                       class="form-control btn btn-login" value="登录">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <div class="text-center">
                                                    <a href="/password/email" tabindex="5"
                                                       class="forgot-password">忘记密码?</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                                <form id="register-form" action="/auth/register" method="post" role="form"
                                      style="display: none;">

                                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                                    <div class="form-group">
                                        <input type="hidden" name="utm" id="utm" value="unknown">
                                    </div>
                                    <div class="form-group">
                                        <input type="text" name="name" id="name" tabindex="1" class="form-control"
                                               placeholder="用户名" value="">
                                    </div>
                                    <div class="form-group">
                                        <input type="email" name="email" id="email" tabindex="1" class="form-control"
                                               placeholder="邮箱" value="">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" name="password" id="password" tabindex="2"
                                               class="form-control" placeholder="密码">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" name="password_confirmation" id="password_confirmation"
                                               tabindex="2" class="form-control" placeholder="再次输入密码">
                                    </div>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-sm-6 col-sm-offset-3">
                                                <input type="submit" tabindex="4" class="form-control btn btn-register"
                                                       value="提交">
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="result-alert none">
            <div class="result_warp">
                <div class="warning">
                    <i class="iconfont">&#xe616;</i><!-- true:&#xe617;   flase:&#xe616;  -->
                </div>
                <p>您未提交【码之初】的正确答案，暂不能回答相关问题。
                    如有疑问，请<a target="_blank" href="/ask">发起讨论</a></p>
                <div class="query">
                    <a class="btn btn-primary result-close">确定</a>
                </div>
            </div>

        </div>
        <!-- 弹窗部分结束 E -->
    </div>
@endsection
@section("js")
    <script src="/js/editormd.js?v=1.0"></script>
	<script src="/js/clipboard.min.js"></script>
    <script src="/js/vote.js"></script>
    <script src="/js/reply.js"></script>
    <script>
        var testEditor;
        $(function () {
            var anchor = window.location.hash;

            if ($(anchor).hasClass("qa-a-item-avatar-meta")) {
                $(anchor).next().removeClass("none");
            } else {
                $(anchor).addClass("targetColor");
            }
            testEditor = editormd("test-editormd", {
                width: "100%",
                height: 600,
                toolbarAutoFixed: false,
                path: 'http://www.qlcoder.com/lib/',
                onload: function () {
                }
            });
            //获取锚点
            var thisId = window.location.hash;
            if (thisId != "" && thisId != undefined) {
                $(thisId).addClass("targetColor");
            }
            $("#test-editormd").click(function () {
                var authority = $(this).attr("data-authority");
                if (authority !== 'undefined') {
                    if (authority == 1)//1:没登陆,2:没权限(充钱???)
                    {
                        $(".authority,.task-shadow").removeClass("none");
                    }
                    else if (authority == 2) {
                        $(".result-alert,.task-shadow").removeClass("none");
                    }
                }

            });
            $('#login-form-link').click(function (e) {
                $("#login-form").delay(100).fadeIn(100);
                $("#register-form").fadeOut(100);
                $('#register-form-link').removeClass('active');
                $(this).addClass('active');
                e.preventDefault();
            });
            $('#register-form-link').click(function (e) {
                $("#register-form").delay(100).fadeIn(100);
                $("#login-form").fadeOut(100);
                $('#login-form-link').removeClass('active');
                $(this).addClass('active');
                e.preventDefault();
            });
            $(".authority-close").click(function () {
                $(".authority,.task-shadow").addClass("none");
            })
            $(".result-close").click(function () {
                $(".result-alert,.task-shadow").addClass("none");
            })
            $(".q-answer").click(function (e) {
				e.preventDefault();
				if($("#textarea").val()!==""){
					$(".loadding_img,.task-shadow").removeClass("none");
					$("#text_html").val($(".markdown-body.editormd-preview-container").html());
					$("#q-answer-form").submit();
					/*$.ajax({
						url:"/replydis",
						type:"post",
						dataType:"json",
						data:{
							_token:$("input[name='_token']").val(),
							text:$("#textarea").val(),
							text_html:$(".markdown-body.editormd-preview-container").html(),
							cid:$("#cid").val()
						},
						success:function(data){
							location.reload();
						}
					})*/
				}else{return !1;}
            })
            $(".commentLogin").click(function () {
                $(".authority,.task-shadow").removeClass("none");
            })
        });
    </script>
    <script src="/js/highlight.pack.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
    <script type="text/x-mathjax-config">
	MathJax.Hub.Config({
		tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
	});

    </script>
    <script>
        $(".qlUser").popover();
		$(window).scroll(function (e) {
        var scrolltop = $(this).scrollTop();
        $(".qa-a-list-item").each(function(){
            var top = $(this).offset().top;
            var height = $(this).height();
            if(height > 100){
                if(scrolltop > top +44 && scrolltop < top + height - 50){
                    $(this).find(".vote").css({"position":"fixed","top":"10px"});
                    $(this).find(".qa-a-item-main").css("margin-left","50px");
                }else{
                    $(this).find(".vote,.qa-a-item-main").removeAttr("style");
                }
            }
        })
    })
	//没代码的情况
	$(".qa-a-list-item").each(function(){
		if($(this).find("pre").length==0){
			$(this).find(".collapsed").hide();
		}
	})
	$(document).on('click',"pre .collapsed",function(){
        var flag = $(this).attr("data-flag");
        if(flag == 1){
			$(this).parent("pre").next(".show-code").remove();
            $(this).parent("pre").css("max-height","inherit");
            $(this).attr("data-flag",2).html("折叠");
        }else{
            $(this).parents("pre").removeAttr("style");
            $(this).attr("data-flag",1).html("展开");
        }
	});
	$(document).on('click','.show-code',function(){
		$(this).prev("pre").css("max-height","inherit").find(".collapsed").attr("data-flag",2).html("折叠");
		$(this).remove();	
	})
	$('pre code').each(function(){
		if($(this).parents("pre").hasClass("prettyprint"))
		{
			return;
		}
        var lines = $(this).text().split('\n').length - 1;
        var $numbering = $('<ul/>').addClass('pre-numbering');
        $(this)
                .addClass('has-numbering')
                .parent()
                .append($numbering);
        for(i=1;i<=lines+1;i++){
            $numbering.append($('<li/>').text(i));
        }
        $('.pre-numbering li').css("height","21px");
	});
	//copy code
	$("pre").each(function(){
		var height = $(this).find("code").height();
        $(this).prepend('<a class="btn clipboard" data-clipboard-snippet ><i class="iconfont icon-fuzhi"></i></a>');
        if(height>300){
            $(this).append('<a href="javascript:;" class="fr collapsed" data-flag="1">展开</a>');
			//$(this).parent(".markdown-body").append('<a href="javascript:;" class="show-code">show code</a>')
			$('<a href="javascript:;" class="show-code">show code</a>').insertAfter($(this));//16.09.26
        }
    });
    var clipboard = new Clipboard('pre .clipboard', {
        target: function(trigger) {
            console.log(trigger.nextElementSibling);
            return trigger.nextElementSibling;
        }
    });
    $("pre .clipboard").each(function () {
        var _this = this;
        $(_this).mouseleave(function(){
            $(this).attr("class","btn clipboard").removeAttr("aria-label");
        })
    });
    clipboard.on('success', function(e) {
        e.clearSelection();
        showTooltip(e.trigger,'Copied!');
    });

    clipboard.on('error', function(e) {
        showTooltip(e.trigger,fallbackMessage(e.action));
    });
    function showTooltip(elem,msg){
        elem.setAttribute('class','btn clipboard tooltipped tooltipped-s');
        elem.setAttribute('aria-label',msg);
    }
    function fallbackMessage(action){
        var actionMsg='';
        var actionKey=(action==='cut'?'X':'C');
        if(/iPhone|iPad/i.test(navigator.userAgent)){
            actionMsg='No support :(';
        }else if(/Mac/i.test(navigator.userAgent)){
            actionMsg='Press ⌘-'+ actionKey+' to '+ action;
        }else{
            actionMsg='Press Ctrl-'+ actionKey+' to '+ action;
        }
        return actionMsg;
    }
    </script>
    <script async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
@endsection
